//
//  ZH_RefundGoodsStateTableViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/31.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_RefundGoodsStateTableViewCell.h"
@interface ZH_RefundGoodsStateTableViewCell()
@property (nonatomic,weak)UIView *cricleView;
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UIButton *leftButton;
@property (nonatomic,weak)UIButton *rightButton;
@end
@implementation ZH_RefundGoodsStateTableViewCell

+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_RefundGoodsStateTableViewCell";
    ZH_RefundGoodsStateTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_RefundGoodsStateTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
- (void)initDefault{
    [self unShowClickEffect];
}
- (void)loadSubviewConstraints{
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(15));
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(FITSCALE(25));
    }];
    [self.cricleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(FITSCALE(9));
        make.width.mas_equalTo(FITSCALE(9));
        make.height.mas_equalTo(FITSCALE(9));
    }];
    [self.leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.titleLabel.mas_right).offset(FITSCALE(19));
    }];
    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView).offset(FITSCALE(-76));
    }];
}
#pragma mark - getter,setter
- (UIView *)cricleView{
    if (!_cricleView) {
        UIView *view = [UIView createViewWithBackgroundColor:[UIColor colorWithHexString:@"#DFDFDF"]];
        view.layer.cornerRadius = FITSCALE(4);
        view.layer.masksToBounds = YES;
        view.clipsToBounds = YES;
        [self.contentView addSubview:_cricleView = view];
    }
    return _cricleView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [UILabel createLabelWithText:@"货物状态:" font:kFontSize_28];
        [self.contentView addSubview:_titleLabel = label];
    }
    return _titleLabel;
}
- (UIButton *)leftButton{
    if (!_leftButton) {
        UIButton *button = [UIButton createButtonWithTitle:@" 未收到货" normalImage:@"icon_yn" pressImage:@"icon_yn_selected" target:self action:nil];
        [self.contentView addSubview:_leftButton = button];
    }
    return _leftButton;
}
- (UIButton *)rightButton{
    if (!_rightButton) {
        UIButton *button = [UIButton createButtonWithTitle:@" 已收到货" normalImage:@"icon_yn" pressImage:@"icon_yn_selected" target:self action:nil];
        [self.contentView addSubview:_rightButton = button];
    }
    return _rightButton;
}
@end
